﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<skags.Models.ChildTimelineViewModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	WHO kúrva barns
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div id="navigation">
<% Html.RenderPartial("IndexNavigation"); %>
</div>
<div id="content">
<h2>Vaxtarkúrfur barna</h2>
<p>Hér getur þú séð upplýsingar um þyngd og hæð barns.<br /> </p>

<!--VELJA BARN -->
<%  if (Model.Children.Count() == 0)
    {
        Response.Write("Þú hefur ekki skráð nein börn.");
    }
    else
    {%>

        
       <div class="chooseChild">
            <p> Veldu barn: </p>
            <ul>
                <% foreach (var cItem in Model.Children)
               {%>
                        <li><%= Html.ActionLink(cItem.Name, "WhoCurve", new { id = cItem.ID })%></li>
                <% }%>
                </ul>
        </div>
        <div id="whocurve">
        <!-- KÚRFAN -->
         </br></br></br>
        <% if (Model.Measurements.Count() == 0)
           {
               Response.Write("Þú hefur ekki sett inn mælingar barnsins.");
           }
           else
           {%>
           
        </br>
        
        
            <script type="text/javascript" src="http://www.google.com/jsapi"></script>
            <script type="text/javascript">
            google.load('visualization', '1', { 'packages': ['annotatedtimeline'] });
            google.setOnLoadCallback(drawChart);
            function drawChart() {
                var data = new google.visualization.DataTable();
                data.addColumn('date', 'Date');
                data.addColumn('number', 'Þyngd');
                data.addColumn('string', 'title1');
                data.addColumn('string', 'text1');
                data.addColumn('number', 'Hæð');
                data.addColumn('string', 'title2');
                data.addColumn('string', 'text2');
                // Loopa i gegnum allar timalinur barnsins
                data.addRows([
                <% foreach(var tItem in Model.Measurements)
                {  %>
                    [new Date(<%=(tItem.LineDate).ToString("yyyy, M-1, d")%>),
                    <%= tItem.CWeight%>, undefined, undefined,
                    <%= tItem.CHeight %>, undefined, undefined],
                <%} %>
                ]);


                var chart = new google.visualization.AnnotatedTimeLine(document.getElementById('chart_div'));
                chart.draw(data, { displayAnnotations: false });
            } 
        </script>
    <%}
    }%>
    </div>
        <span id= "takki">
            <%= Html.ActionLink("Skrá mælingar", "AddMeasurements")%>
            <%= Html.ActionLink("Breyta mælingum", "TimelineList")%>
        </span>
    
    <div id='chart_div' style='width: 500px; height: 240px;'></div>
    <div id="whoLinks">
        <p> Hér getur þú séð vaxtarkúrfur W.H.O. sem sýna viðmið um vöxt barna.</p>
    </div>
        Stelpur:&nbsp
        <span id="girlLink">
             <a href="http://www.who.int/nutrition/media_page/cht_wfa_girls_z_0_5.pdf"> Þyngd </a>
             &nbsp-&nbsp
             <a href="http://www.who.int/nutrition/media_page/cht_lhfa_girls_z_0_5.pdf"> Hæð</a>
        </span>
        &nbsp&nbsp Strákar:&nbsp
        <span id= "boyLink">
             <a href="http://www.who.int/nutrition/media_page/cht_wfa_boys_z_0_5.pdf"> Þyngd </a>
             &nbsp-&nbsp
             <a href="http://www.who.int/nutrition/media_page/cht_lhfa_boys_z_0_5.pdf"> Hæð</a>
        </span>
  
</div>
</asp:Content>